package factorymethod;

import org.junit.Test;

/**
 * 测试
 *
 * @author Administrator
 */


public class Test1 {
    /**
     * 简单工厂测试
     */
    @Test
    public void testSimplePizzaFactory() {
        Pizza pizza = SimplePizzaFactory.createPizza("cheese");
        System.out.println("testSimplePizzaFactory");
        pizza.prepare();
        pizza.bake();
        pizza.cut();
        pizza.box();
    }

    /**
     * 简单方法工厂测试
     */
    @Test
    public void testPizzaFactory() {
        PizzaFactory cfactory = new CheesePizzaFactory();
        System.out.println("testPizzaFactory");
        Pizza cpizza = cfactory.createPizza();
        cpizza.prepare();
        cpizza.bake();
        cpizza.cut();
        cpizza.box();

        PizzaFactory gfactory = new GreekPizzaFactory();
        System.out.println("testPizzaFactory");
        Pizza gpizza = gfactory.createPizza();
        gpizza.prepare();
        gpizza.bake();
        gpizza.cut();
        gpizza.box();
    }

}
